package com.zl.tby.vo.exp;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.zl.tby.model.TbyCameraInfo;
import com.zl.tby.vo.TbyCameraInfoForm;
import lombok.Data;
import org.noear.solon.validation.annotation.Length;
import org.noear.solon.validation.annotation.NotBlank;

import java.util.ArrayList;
import java.util.List;

/**
 * 相机信息
 * @author changpeng
 * @version 1.0
 * @since 2024/8/6 20:12
 */
@Data
public class TbyCameraInfoExportExcel {

    /**设备名称*/
    @ExcelProperty(value = "设备名称", index = 0)
    @ColumnWidth(15)
    private String name;
    /**设备编码*/
    @ExcelProperty(value = "设备编码", index = 1)
    @ColumnWidth(15)
    private String code;
    /**经度*/
    @ExcelProperty(value = "经度", index = 2)
    @ColumnWidth(15)
    private String longitude;
    /**纬度*/
    @ExcelProperty(value = "纬度", index = 3)
    @ColumnWidth(15)
    private String latitude;

    public static List<TbyCameraInfoExportExcel> createList(List<TbyCameraInfo> dbList) {
        List<TbyCameraInfoExportExcel> list = new ArrayList<>();
        dbList.forEach(item -> {
            TbyCameraInfoExportExcel excel = new TbyCameraInfoExportExcel();
            excel.setCode(item.getCode());
            excel.setName(item.getName());
            excel.setLongitude(item.getLongitude());
            excel.setLatitude(item.getLatitude());
            list.add(excel);
        });
        return list;
    }
}
